package org.jtao.gbsubject.service.dto;


import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.Objects;

/**
 * A DTO for the Subject entity.
 */
public class SubjectDTO implements Serializable {

    private Long id;

    private String name;

    private String code;

    private Integer studentSum;

    private Long subjectClazzId;

    private String subjectClazzName;

    private Set<CollegeDTO> colleges = new HashSet<>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getStudentSum() {
        return studentSum;
    }

    public void setStudentSum(Integer studentSum) {
        this.studentSum = studentSum;
    }

    public Long getSubjectClazzId() {
        return subjectClazzId;
    }

    public void setSubjectClazzId(Long subjectClazzId) {
        this.subjectClazzId = subjectClazzId;
    }

    public String getSubjectClazzName() {
        return subjectClazzName;
    }

    public void setSubjectClazzName(String subjectClazzName) {
        this.subjectClazzName = subjectClazzName;
    }

    public Set<CollegeDTO> getColleges() {
        return colleges;
    }

    public void setColleges(Set<CollegeDTO> colleges) {
        this.colleges = colleges;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        SubjectDTO subjectDTO = (SubjectDTO) o;
        if(subjectDTO.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), subjectDTO.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "SubjectDTO{" +
            "id=" + getId() +
            ", name='" + getName() + "'" +
            ", code=" + getCode() +
            ", studentSum=" + getStudentSum() +
            "}";
    }
}
